//
//  GameScene.h
//  CandyCrushClone
//

//  Copyright (c) 2014 Nestorov Engineering. All rights reserved.
//

@import SpriteKit;

@class RWTLevel;
@class RWTSwap;

typedef NS_ENUM(NSUInteger, GameState)
{
    GameStateStartingLevel = 1,
    GameStatePlaying       = 2,
    GameStateInMenu        = 3,
    GameStateGameOver      = 4,
};

@protocol SceneDelegate <NSObject>

- (void)abortGame;
- (void)startNewGame;

@end


@interface RWTMyScene : SKScene

@property (weak, nonatomic) RWTLevel *level;

// isSimulation is used to determine when the swap is maden from me
@property (copy, nonatomic) void (^swipeHandler)(RWTSwap *swap, BOOL isSimulation);
@property (weak) id<SceneDelegate> sceneDelegate;
@property (nonatomic) GameState gameState;
@property (nonatomic, assign) BOOL canMakeMove;

- (void)addSpritesForCookies:(NSSet *)cookies;
- (void)addSpritesForCookiesFromServer:(NSSet *)cookies;
- (void)addTiles;
- (void)animateSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion;
- (void)animateInvalidSwap:(RWTSwap *)swap completion:(dispatch_block_t)completion;
- (void)animateMatchedCookies:(NSSet *)chains completion:(dispatch_block_t)completion;
- (void)animateFallingCookies:(NSArray *)columns completion:(dispatch_block_t)completion;
- (void)animateNewCookies:(NSArray *)columns completion:(dispatch_block_t)completion;
- (void)animateGameOver;
- (void)animateBeginGame;
- (void)removeAllCookieSprites;

- (void)adjustSceneForSmallDisplay;
- (void)resetTimerAndShouldShowHint:(BOOL)shouldShowHint additionalDelay:(float)delay;
- (void)updateLabels;
- (void)playShuffleImageAnimation;
- (void)playHeroAnimationIfNecessary;
- (void)playComboAnimationIfNecessary;
- (void)cleanScene;

@end